package com.abc.cloud.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.abc.cloud.entity.UserNoticeEntity;
import com.abc.cloud.service.UserNoticeService;
import com.abc.cloud.common.utils.PageUtil;
import com.abc.cloud.common.utils.Result;



/**
 * 用户通知表
 *
 * @author LiJunXi
 * @email 2770063826@qq.com
 * @date 2023-11-29 13:19:41
 */
@RestController
@RequestMapping("cloud/usernotice")
public class UserNoticeController {
    @Autowired
    private UserNoticeService userNoticeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(@RequestParam Map<String, Object> params){
        PageUtil page = userNoticeService.queryPage(params);

        return Result.success(page, "page");
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{userId}")
    public Result info(@PathVariable("userId") Long userId){
		UserNoticeEntity userNotice = userNoticeService.getById(userId);

        return Result.success(userNotice, "userNotice");
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public Result save(@RequestBody UserNoticeEntity userNotice){
		userNoticeService.save(userNotice);

        return Result.success(null, "");
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody UserNoticeEntity userNotice){
		userNoticeService.updateById(userNotice);

        return Result.success(null, "");
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public Result delete(@RequestBody Long[] userIds){
		userNoticeService.removeByIds(Arrays.asList(userIds));

        return Result.success(null, "");
    }

}
